#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 7;
int a[maxn], s[maxn];
int N;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> a[i];
  for (int i = 1; i <= N; ++i) {
    s[i] = 1;
    for (int j = 1; j < i; ++j) {
      if (a[j] < a[i] && s[j] + 1 > s[i]) s[i] = s[j] + 1;
    }
  }

  cout << *max_element(s + 1, s + 1 + N) << endl;

  return 0;
}

